﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;

using GameEngine;

namespace Daphne.Controls
{
    /// <summary>
    /// Interaction logic for OnMoveControl.xaml
    /// </summary>
    public partial class OnMoveControl : UserControl
    {
        private string _sWhite = "AppData/Pictures/over_butt_who.png";
        private string _sBlack = "AppData/Pictures/butt_who.png";
        private string _sAppPath;

        public OnMoveControl()
        {
            InitializeComponent();
        }

        public GameManager GameManager
        { get; set; }

        public void SetData(string sAppPath, GameManager gameManager)
        {
            GameManager = gameManager;
            _sAppPath = sAppPath;
        }

        public void Update()
        {
            if (GameManager == null)
                return;
            string sPath = GameManager.GameBoard.OnMove == enumFigureColor.White ?
                    System.IO.Path.Combine(_sAppPath, _sWhite) : System.IO.Path.Combine(_sAppPath, _sBlack);

            BitmapImage image = new BitmapImage(new Uri(sPath));
            uxImage.Source = image;
        }
    }
}
